<%
response.setStatus(500);

// 获取异常类
Throwable ex = Exceptions.getThrowable(request);
if (ex != null){
	LoggerFactory.getLogger("500.jsp").error(ex.getMessage(), ex);
}

// 编译错误信息
StringBuilder sb = new StringBuilder("错误信息：\n");
if (ex != null) {
	sb.append(Exceptions.getStackTraceAsString(ex));
} else {
	sb.append("未知错误.\n\n");
}

// 如果是异步请求或是手机端，则直接返回信息
if (Servlets.isAjaxRequest(request)) {
	out.print(sb);
}

// 输出异常信息页面
else {
%>
<%@page import="org.slf4j.Logger,org.slf4j.LoggerFactory"%>
<%@page import="com.chain.qs.common.web.Servlets"%>
<%@page import="com.chain.qs.common.utils.Exceptions"%>
<%@page import="com.chain.qs.common.utils.StringUtils"%>
<%@page contentType="text/html;charset=UTF-8" isErrorPage="true"%>
<%@include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<title>500 - 系统内部错误</title>
	<%@include file="/WEB-INF/views/include/nhead.jsp" %>
	<link href="${ctxStatic}/lightblue/css/application.css" rel="stylesheet">
</head>
<body class="background-dark">
<div class="body body-row">
	<div class="error-container "></div>
		<div class="errorMessage btn1">
			<main class="row">
				<h1 class=" col-xs-12  col-lg-4 error-codes">500<span class="error-cod">  系统内部错误！</span></h1>
			</main>
			错误信息：<%=ex==null?"未知错误.":StringUtils.toHtml(ex.getMessage())%> <br/> <br/>
			请点击“查看详细信息”按钮，将详细错误信息发送给系统管理员，谢谢！<br/> <br/>
			<main class="text-align-center">
				<div class="row">
					<div class="col-lg-12 form-actions form-width">
						<a href="javascript:" onclick="history.go(-1);" class="btn btn-blues">返回上一页</a> &nbsp;
						<a id="btn2" href="javascript:" onclick="$('.errorMessage').toggle();" class="btn btn-inverse">查看详细信息</a>
						<%--<a id="btn2" href="javascript:" onclick="$('.errorMessage').toggle();" class="btn btn-inverse">查看详细信息</a>--%>
					</div>
				</div>
			</main>
		</div>
		<div class="errorMessage btn2" style="display: none;">
			<div class="error-page container">
				<%=StringUtils.toHtml(sb.toString())%> <br/>
				<main class="text-align-center">
					<div class="row">
						<div class="col-lg-12">
							<a href="javascript:" onclick="history.go(-1);" class="btn btn-blues">返回上一页</a> &nbsp;
							<a href="javascript:" onclick="$('.errorMessage').toggle();" class="btn btn-inverse">隐藏详细信息</a>
							<br/> <br/>
						</div>
					</div>
				</main>
			</div>
		</div>
</div>
<script>
	$(document).ready(function(){
		$("#btn2").click(function(){
			$(".btn2").show();
			$(".btn1").hide();
		});
	});
</script>
</body>
</html>
<%
} out = pageContext.pushBody();
%>